package com.xt.mvcpilot.service;

import java.util.List;
import java.util.Set;

import com.xt.core.exception.ObjectCanNotSaveException;

import com.xt.mvcpilot.data.User;
import com.xt.mvcpilot.data.Role;
import com.xt.mvcpilot.data.Permission;

import com.xt.mvcpilot.exception.DaoException;

/**
 * class for the xtmvcpilot application
 * 
 * server class to get User information, called by Controller
 * 
 * @author txiao
 * @version Revision: 1.0, Date: 07.06.2011
 * 
 */
public interface UserService extends AppBasicService<User, Long>{
	
	
	/****** functions for Role ******/
	
	//get all the role
	public Set<Role> getAllRoles();
	
	//the a role by id
	public Role getRole(Long id);
	
	//save a role
	public void saveRole(Role role) throws DaoException;
	
	//add a permission to a role
	public Role addPermissionToRole(Role role, Permission permission) throws DaoException;
	
	//remove a permission from a role
	public Role removePermissionFromRole(Role role, Permission permission) throws DaoException;
	
	//delete a role
	public void deleteRole(Role role) throws DaoException;
	public void deleteRoleById(Long id) throws DaoException;
	
	//
	/****** functions for Permission ******/
	//get all the permissions
	public Set<Permission> getAllPermissons() throws DaoException;
	
	//get the permission by the id
	public Permission getPermission(Long id);
	
	//save a permission
	public void savePermission(Permission permission) throws DaoException;
	
	//delete a permission
	public void deletePermission(Permission permission) throws DaoException;
	public void deletePermissionById(Long id) throws DaoException;
	
	
}
